package io.github.talelin.latticy.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.util.Date;

@Entity
@Getter
@Setter
@Where(clause = "delete_time is null and online = 1")
public class Job extends BaseEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private Long projectId;
    private Long userId;
    private String title;
    private String description;
    private Boolean status;
    private String type;
    private String remark;

    @JsonIgnore
    private Boolean online;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "PRC")
    private Date createTime;

    private Long jobId;

    @OneToOne
    @JoinColumn(name = "projectId", insertable = false, updatable = false)
    @NotFound(action= NotFoundAction.IGNORE)
    private Project project;


}
